from django.contrib import admin
from django.contrib.auth.models import Group
from .models import Article, Comment, Edit, Child


# Register your models here.


class ArticleAdmin(admin.ModelAdmin):
    list_display = ('title', 'author', 'publish_time', 'content', 'classify')
    ordering = ('title',)


class CommentAdmin(admin.ModelAdmin):
    list_display = ('comment_userlink', 'comment_time', 'comment_content')


class EditAdmin(admin.ModelAdmin):
    list_display = ('edit_userlink', 'edit_time', 'remark')


class ChildAdmin(admin.ModelAdmin):
    list_display = ('father_list', 'child_list')
    ordering = ('father_list',)
    fieldsets = [
        (None, {'fields': ['father_list']}),
        ('Date information', {'fields': ['child_list']}),
    ]


admin.site.register(Article, ArticleAdmin)
admin.site.register(Comment, CommentAdmin)
admin.site.register(Child, ChildAdmin)
admin.site.register(Edit, EditAdmin)
admin.site.unregister(Group)

admin.AdminSite.site_header = "知识库后台 - 管理员"
admin.AdminSite.site_title = "知识库"
